<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 
<%@ page import="com.lmpop.trade.ti_admin.*"%>
<%@ page import="com.lmpop.frame.dao.MenuInfo"%>
<%@ page import="com.lmpop.frame.pojo.Menuinfo"%>
<% 
	Map menuinfos= new Hashtable();
	menuinfos.put("subsys_code","SYS");
	menuinfos.put("menu_class","2");
	String up_menu_id = "03702fX5Wt1ifJ8";
	if(request.getParameter("menu_id")!=null && !request.getParameter("menu_id").equals("")){
		up_menu_id = request.getParameter("menu_id");
	}
	menuinfos.put("up_menu_id",up_menu_id);
	menuinfos.put("is_hidden","1");

	String role_code = "";
	if(session.getAttribute("session_role_code")!=null && !((String)session.getAttribute("session_role_code")).equals("")){
		role_code = (String)session.getAttribute("session_role_code");
		menuinfos.put("role_code",role_code);
	}
	 String user_type = "";
	if(session.getAttribute("session_user_type")!=null && !((String)session.getAttribute("session_user_type")).equals("")){
		user_type = (String)session.getAttribute("session_user_type");
		menuinfos.put("user_type",user_type);
	}
	  
	String user_id = "";
	if( session.getAttribute("session_user_id") != null ){
		user_id = session.getAttribute("session_user_id").toString();
	}
	Ti_adminInfo adminInfo = new Ti_adminInfo();
	String cust_class = adminInfo.getCustClassByUserID(user_id);
	if(cust_class != null && !cust_class.equals("")){
		menuinfos.put("cust_class",cust_class);
	}
		
	MenuInfo menuInfo = new MenuInfo();
	
	List menuList = null;
	//out.print(menuinfos);
	if(user_type.equals("0") ){
		menuList = menuInfo.getListByPage(menuinfos);
	} else if(user_type.equals("1") ){
		menuList = menuInfo.getMenuinfoByRole(menuinfos);
	} 

	int msize = 0;
	if(menuList!=null && menuList.size()>0){
		msize = menuList.size();
	}
   
    
%>
<html>
  <head>
    <title>运营商后台</title>
	<link href="/program/admin/index/css/css.css" rel="stylesheet" type="text/css" />
	<style type="text/css">
		html, body {height:100%;}
		body {font-family:Arial, Helvetica, sans-serif; font-size:12px; margin:0px; text-align:center; border-right:1px #ccc solid;}
		a {color: #000; text-decoration: none;}
		#menu img {_margin-top: 12px;}
		#all {width: 100%;height:100%;}
		#menu {width: 96%;}
		#menu ul {padding:0; margin: 0; list-style: none;}
		#menu ul li {text-align:left;padding-left:15px; font-weight:bold;background-image:url(/program/admin/index/images/menu_bg.gif); background-repeat: repeat-x; background-position:center; height: 32px;;margin-top: 2px; margin-bottom: 2px; border:1px #CCDEF4  solid; line-height: 2.8;}
	</style>
 
	
  </head>
  


<body onLoad="setWindowSize()">
<div id="cont">
    <div id="cont_l f_left">
	<div class="cont_l_ul">
        <ul >
        <li class="cont_l_title"><a href="/program/admin/index/main.jsp" target="main" style="color:#fff">管理首页</a></li>
        	<% 
    			if(menuList!=null && menuList.size()>0){
    				Hashtable mMap = new Hashtable();
    				for(int i=0;i<menuList.size();i++){
    					mMap = (Hashtable)menuList.get(i);
    					String menu_id = "",menu_name="";
    					if(mMap.get("menu_id")!=null) menu_id = mMap.get("menu_id").toString();
    					if(mMap.get("menu_name")!=null) menu_name = mMap.get("menu_name").toString();
						String module_paths = menuInfo.getModuleFile(menu_id);
						module_paths = module_paths.replace("WebRoot/","");
						List children = new ArrayList();
						
						String isTop="cont_t_l_li";
    					if(i==0) isTop="cont_l_title";
						String display="display:none";
						if(!menu_id.equals("")){
							//children = menuInfo.getMenuinfoByUpId(menu_id);
							menuinfos.put("up_menu_id",menu_id);
							menuinfos.put("menu_class","3");
							children= menuInfo.getMenuinfoByRole(menuinfos);
						}
						
						
    		%> 
			<ul >
				
				<%
					if(children!=null && children.size()>0){
				%>
    			 
				<li  class="cont_t_l_li" id="leftmenu<%=i%>" style="CURSOR: pointer" onClick="javascript:ShowFLT(<%=i%>)">&nbsp;&nbsp;<%=menu_name%></li> 
				<%
					}else {
				%>
				<li  class="cont_t_l_right" id="leftmenu<%=i%>" style="CURSOR: pointer" onClick="javascript:ShowFLT(<%=i%>)"><a href="<%=module_paths%>?menu_id=<%=menu_id%>" target="main" >&nbsp;&nbsp;<%=menu_name%></a></li>
				<%
					}
				%>
			</ul >
				
				<ul id="LM<%=i%>" style="<%=display%>">
									
				<%
				if(children!=null && children.size()>0){
					Hashtable twoMenuMap = new Hashtable();
					for(int j=0;j<children.size();j++){
						twoMenuMap = (Hashtable)children.get(j);
						String c_name="",c_menu_id="";
						if(twoMenuMap.get("menu_name")!=null){
							c_name = twoMenuMap.get("menu_name").toString();
						}
						if(twoMenuMap.get("menu_id")!=null){
							c_menu_id = twoMenuMap.get("menu_id").toString();
						}
						String module_path = menuInfo.getModuleFile(c_menu_id);
						module_path = module_path.replace("WebRoot/","");
				%>
								  
				 
				<li  class="drop_li"><a href="<%=module_path%>?menu_id=<%=c_menu_id%>" target="main"><font style="color:#335B64"><%=c_name%></font></a></li>
				<%
				  
					}
				 }
				%>
													
				</ul>
    		<%
    				}
    			}
    		%>
        
        </ul>
		</div>
    </div>
</div>
</body>
	
</html>
		<script language="javascript" id="clientEventHandlersJS">
			
			var number=<%=msize%>;
			
			function LMYC() {
				var lbmc;
			 	var treePic;
				for (i=0;i<number;i++) {
					lbmc = document.getElementById('LM' + i);
					lbmc.style.display = 'none';
				}
			}
			 
			function ShowFLT(i) {
				lbmc = document.getElementById('LM' + i);
				if (lbmc.style.display == 'none') {
					LMYC();	
					lbmc.style.display = '';
				}else {
					lbmc.style.display = 'none';
				}
			}
		</script>

		<script type="text/javascript">
		 function setWindowSize(){ //iframe自动本窗口高度
		 try{
		  var thiswin = window.parent.document.getElementById(window.name);
		  if(window.document.body.scrollWidth-thiswin.offsetWidth>6){
		   document.body.style.overflowX="auto";
		   thiswin.height=window.document.body.scrollHeight+20;
		   thiswin.width=window.document.body.scrollWidth+20;
		  }else{
		   document.body.style.overflowX="hidden";
		   thiswin.height=window.document.body.scrollHeight;
		   thiswin.width=window.document.body.scrollWidth
		  }
		 }catch(e){ } 
		 }
		</script>